< previous page page_134 next page >

Page 134
Building ActiveX DLLs and EXEs
In this section, you'll create an ActiveX DLL by using the code in Listing 4.1 (from Day 4, Fundamental Object-Oriented Programming). For your convenience, Listing 6.1 includes the code from Listing 4.1. Also included in the listing is a general code module with a Sub Main method. Normally, you would not need to include a Sub Main in an ActiveX DLL, unless you planned to initialize the component. In this case, you expect to initialize the component with the amount of the deposit and the account number.
Note
A general code module is also known as a class utility in Visual Modeler.

LISTING 6.1. THE CODE FOR CREATING AN ACTIVEX DLL FOR THE SECOND BANK OF CARROLLTON.

9f8044bafea36a1f728739c0bb58ef4c.gif
 1: Module: modMain
 2: Methods: Public Sub Main()
 3:
 4: Object: theDeposit
 5:
 6: Methods:
 7: Public Function depositFunds (argAccountNumber As String, argAmount As
     Single)
 8:     Well use Call for the sake of simplicity.
 9:     Call theBasicPersonalCheckingAccount.adjustBalance(Me,
         argAccountNumber)
10: End Function
11:
12: Properties:
13: Amount
14:
15:
16: Object: theBasicPersonalCheckingAccount
17:
18: Methods:
19: Public Function adjustBalance(ByRef argObject, argAccountNumber As String)
20:     Dim LocalObject As Object
21:
22:     'If there's more than one account object in memory, a precondition
23:     'is that this object is the correct object. So check account number
24:     If argAccountNumber <> AccountNumber Then
25:          'Raise exceptions here
26:          
27:          Exit Function
continues

 
< previous page page_134 next page >

If you like this book, buy it!